#!/bin/bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

cd $SCRIPT_DIR

echo "Usage: $SCRIPT_DIR"

current_time=$(date +"%Y-%m-%d-%H-%M-%S")

echo "current_time: $current_time"
# 检查第一个参数，如果不存在将使用默认值 "default"
record_name=${1}
# record_name=${1:-0}
rate=${2:-1}
start=${3:-0}
# bag_path="/home/user/bag/711/"
record_name=$record_name

echo  "play bag: " $record_name

# 将ROS图像压缩格式转为RAW格式
# rosrun image_transport republish compressed in:=/slave1/image_raw raw out:=/slave1/image_raw
# rosrun image_transport republish compressed in:=/realsense/color/image_raw/compressed raw out:=/realsense/color/image_raw
# rosbag play $record_name --topics /zhz/camera/camera_info /zhz/camera/image_l -r $rate -s $start --clock -l
rosbag play $record_name --topics /zhz/driver/camera_info /zhz/driver/image_l -r $rate -s $start --clock -l